﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;



namespace WindowsGame
{
	public class Text
	{
		protected SpriteFont spriteFont;
		protected string captionStr;
		Color color;

		protected Texture2D captionImg = null;

		protected Vector2 position;



		public Text(Texture2D captionIn, Vector2 positionIn)
		{
			captionImg = captionIn;
			position = positionIn;
		}


		public Text(string captionIn, Color colorIn, Vector2 positionIn, SpriteFont spriteFontIn)
		{
			captionStr = captionIn;
			color = colorIn;
			position = positionIn;
			spriteFont = spriteFontIn;
		}



		public void ChangeCaption(Texture2D captionIn)
		{
			captionImg = captionIn;
		}



		public void ChangeCaption(string captionIn)
		{
			captionStr = captionIn;
		}



		public virtual void Update(GameTime gameTime)
		{
		}



		public virtual void Draw(SpriteBatch spriteBatch, GameTime gameTime, float scale)
		{
			if(captionImg != null)
				spriteBatch.Draw(captionImg, position, null, Color.White, 0.0f, Vector2.Zero, scale, SpriteEffects.None, 0.0f);
			else
				spriteBatch.DrawString(spriteFont, captionStr, position, color, 0.0f, Vector2.Zero, scale, SpriteEffects.None, 0.0f);
		}
	}
}
